package nju.mscs.data.object;

import java.io.Serializable;

public class TotalDiscountPromotion extends Promotion implements Serializable, DiscountPromotion,TotalPromotion {
	private double discount;
	private double min,max;
	TotalDiscountPromotion(String id,double min,double max,double  discount,Date begin,Date over){
		super(id,Promotion.TotalDiscountPromotion,begin,over);
		this.min = min;
		this.max = max;
		this.discount = discount;
		
	}
	
	
	@Override
	public boolean check(double total) {
		if((this.max>total||this.max==0)&&this.min<total)
			return true;
		return false;
	}

	@Override
	public double getDiscount() {
		return discount;
	}
	public void setDiscount(double discount) {
		this.discount = discount;
	}

	@Override
	public int getType() {
		// TODO Auto-generated method stub
		return this.type;
	}

	@Override
	public void setTotal(double min, double max) {
		this.max = max;
		this.min = min;
	}


	@Override
	public String getTotal() {
		// TODO Auto-generated method stub
		return this.min+"~"+this.max;
	}


	@Override
	public double getMax() {
		// TODO Auto-generated method stub
		return max;
	}


	@Override
	public double getMin() {
		// TODO Auto-generated method stub
		return min;
	}
}
